<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<c:set var="ctx" value="${pageContext.request.contextPath}" />
<html>
<script>
	var ctx = "${ctx}";
</script>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="keywords"
	content="">
<meta name="description"
	content="">
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="Cache-Control" content="no-cache, must-revalidate">
<meta http-equiv="expires" content="Wed, 26 Feb 209908:21:57 GMT">
<link rel="shortcut icon" href="favicon.ico">
	<link href="${ctx}/static/css/bootstrap.min.css?v=${static_version}" rel="stylesheet" />
	<link href="${ctx}/static/css/font-awesome.min.css?v=4.4.0?v=${static_version}" rel="stylesheet" />
	<link href="${ctx}/static/css/animate.min.css?v=${static_version}" rel="stylesheet" />
	<link href="${ctx}/static/css/style.min.css?v=${static_version}" rel="stylesheet" />
	<link href="${ctx}/static/css/common.css?v=${static_version}" rel="stylesheet" />
	<link href="//at.alicdn.com/t/font_9x03jhokyws9vn29.css" rel="stylesheet">
	<!-- Data Tables -->
	<link href="${ctx}/static/css/plugins/dataTables/dataTables.bootstrap.css?v=${static_version}" rel="stylesheet" />
<title>赛事管理</title>
</head>
<body class="gray-bg">
	<div class="wrapper wrapper-content  animated fadeInRight">
		<div class="ibox float-e-margins">
	 		<div class="ibox-title">
            	<h5>赛事管理<small></small></h5>
            </div>		
            
			<div class="ibox-content">
				<div class="row  m-b-xs">
				<form action="${ctx}/views/u_match-info-list" method="get" class="form form-horizontal" id="search-form">				
					<div class="col-sm-1 m-t-xs">分类：</div> 
					<div class="col-md-2 col-sm-2">
						<select data-placeholder="--不限--" name="match_cate" class="input-md form-control chosen-select" tabindex="4">
		                    <option value="-1">--不限--</option>
	                    	<c:forEach items="${match_cates_list}" var="cate">
							<option value="${cate.item_value}" 
								<c:if test="${match_cate==cate.item_value}">selected</c:if>>${cate.display_name}
							</option>					
							</c:forEach>
		                </select>
					</div>
						
					<div class="col-sm-1 m-t-xs">状态：</div> 
					<div class="col-md-2 col-sm-2">
						<select data-placeholder="--全部--" name="status" class="input-md form-control chosen-select" tabindex="4">
	                    	<option value="-1">--全部--</option>
							<option value="0"
								<c:if test="${status == 0}">selected</c:if>>待审核</option>
							<option value="1"
								<c:if test="${status == 1}">selected</c:if>>审核通过</option>
							<option value="2"
								<c:if test="${status == 2}">selected</c:if>>审核不通过</option>
		            	</select>
					</div>
						
					<div class="col-md-1 col-sm-1">
						<button name="" id="" class="btn btn-primary radius" type="submit">搜索</button>								
					</div>
					
					<div class="col-md-1">
						<a class="btn btn-warning btn-outline radius" onclick="javascript:location.replace(location.href);"
						href="javascript:location.replace(location.href);">刷新</a> 
				    </div>				
				</form>
			</div>
			
			 <div class="hr-line-dashed3"></div>	
			<table data-action="" data-datatable="true"  class="table table-striped table-bordered table-hover dataTables-example">
				<thead>
					<tr class="text-c">                        
                        <th class="text-center">赛事名</th>
                        <th class="text-center">缩略图</th>
                        <th class="text-center">跳转至H5</th>
                        <th class="text-center">参赛名额</th>
                        <th class="text-center">投放金额（元）</th>                          
                        <th class="text-center">时间</th>
                        <th class="text-center">状态</th>                         
						<th class="text-center">操作</th>
					</tr>
				</thead>
				<tbody>
					<c:forEach items="${u_matchs}" var="u_match">						
						<tr class="text-c">
                            <td class="text-center">${u_match.match_name}</td>
                            <td class="text-center">
                            	<img src = "${u_match.thumbnail}" style="width:50px;height:50px">
                            </td>
                            <td class="text-center">${u_match.thumbnail_h5}</td>
                            <td class="text-center">${u_match.join_count}</td>
                            <td class="text-center">${u_match.amount}</td>
                            <td class="text-center">${u_match.pstart_time}
                            		至
                            	${u_match.pend_time}
                            </td>
                            <td class="text-center">
                             <c:if test="${u_match.status == 0}">
                           		  待审核
                           	</c:if>
                             <c:if test="${u_match.status == 1}">
                           		  审核通过
                           	</c:if>
                           	<c:if test="${u_match.status == 2}">
                           		  审核不通过
                           	</c:if>
                           </td>                             
							<td class="td-manage text-center">
							<a class="btn btn-primary radius"
								onClick="u_match_detail(this,'${u_match.match_id}')" href="javascript:void(0);"
								title="查看详情">查看详情</a>
								&nbsp;&nbsp;&nbsp;&nbsp;						
							<a class="btn btn-primary radius"
								onClick="u_match_edit(this,'${u_match.match_id}')" href="javascript:void(0);"
								title="编辑">编辑</a>
								&nbsp;&nbsp;&nbsp;&nbsp;
							<a class="btn btn-primary radius"
								onClick="u_match_delete(this,'${u_match.match_id}')" href="javascript:void(0);"
								title="删除">删除</a>
							</td>
						</tr>
					</c:forEach>
				</tbody>
			</table>
		</div>
	</div>
	</div>
		
	<!-- 插件脚本 -->
	<script src="${ctx}/static/js/jquery.min.js?v=${static_version}"></script>
	<script src="${ctx}/static/js/bootstrap.min.js?v=${static_version}"></script>
	<script src="${ctx}/static/js/plugins/layer/layer.js?v=${static_version}"></script>
	<script src="${ctx}/static/js/plugins/dataTables/jquery.dataTables.js?v=${static_version}"></script>
	<script src="${ctx}/static/js/plugins/dataTables/dataTables.bootstrap.js?v=${static_version}"></script>
	<script type="text/javascript">
	
	$(document).ready(function() {
		$(".dataTables-example").dataTable();
	});
	
		$(function() {
			$('.table-sort').dataTable({
				"aaSorting" : [ [ 0, "desc" ] ],//默认第几个排序
				"bStateSave" : true,//状态保存
				"aoColumnDefs" : [
				//{"bVisible": false, "aTargets": [ 3 ]} //控制列的隐藏显示
				{
					"orderable" : false,
					"aTargets" : [ 1, 2 ]
				} // 制定列不参与排序
				]
			});
			
		}); 

		/*添加*/
		function u_match_add(title, url, w, h) {
			layer_show(title, url, w, h);
		}

		/*编辑*/
		function u_match_edit(obj,id,w,h){
			var edit_page = "${ctx}/views/u_match-add-info-pre?id="+id;
			
			var index = layer.open({
				type: 2,
				title: "编辑",
				content: edit_page
			});
			layer.full(index);
			/* layer_show("编辑",edit_page,w,h); */
		}
		
		/*查看详情*/
		function u_match_detail(obj,id,w,h){
			var info_page = "${ctx}/views/u_match-detail-info-pre?id="+id;
			var index = layer.open({
				type: 2,
				title: "查看详情",
				content: info_page
			});
			layer.full(index);
		}

		/*删除*/
		function u_match_delete(obj,id){
			layer.confirm('确认删除？', {
				btn: ['确认','取消'], 
				shade: false
			},
			function(){
				$.ajax({
					type : "POST",
					url : "${ctx}/views/u_match-delete",
					data : "id=" + id,
					error : function() {
						layer.msg('操作失败', {icon:5,time:1000});
					},
					success : function(msg) {
						layer.msg('已删除 ', {icon:6,time:1000});
						location.href ="${ctx}/views/u_match-info-list"; 
					}
				});
			},
			function(){
				layer.msg('未删除', {icon:5,time:1000});
			});	
		}
	</script>
</body>
</html>



